import {
	defineStore
} from 'pinia';

export const useOrderStore = defineStore('order', {
	state: () => {
		return {
			total: 0,
			obj: {},
			pay: {},
			couponId: '', // 优惠券id
			package: null, // 套餐
			couponInfo: null,
			date: '',
			extendFlag: false,
			extendInfo: {},
		};
	},
	getters: {
		getOrder(state) {
			return state.total;
		},
		getOrderObj(state) {
			return state.obj;
		},
		getOrderPay(state) {
			return state.pay;
		},
		getOrderCouponId(state) {
			return state.couponId;
		},
		getExtendFlag(state) {
			return state.extendFlag
		},
		getExtendInfo(state) {
			return state.extendInfo
		},
	},
	actions: {
		setOrderState(data) {
			this.total = data;
		},
		setOrderObjState(data) {
			this.obj = data;
		},
		setOrderPayState(data) {
			this.pay = data;
		},
		setOrderCouponIdState(data) {
			this.couponId = data;
		},
		setPackage(data) {
			this.package = data
		},
		setCouponInfo(data) {
			this.couponInfo = data
		},
		setDate(data) {
			this.date = data
		},
		setExtendFlag(data) {
			this.extendFlag = data
		},
		setExtendInfo(data) {
			this.extendInfo = data
		}
	},
});